package com.fyzk.activity.prize.item;

import android.graphics.Color;
import android.graphics.Typeface;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;

import com.fyzk.activity.app.App;
import com.fyzk.data.AppLotteryInfos;
import com.fyzk.utils.AppUtil;
import com.fyzk.utils.LotteryIDUtils;
import com.tyjc.lottery.R;

public class FC3DPrizeItem extends PL3PrizeItem implements
		PrizeNumFormatInterface {


	@Override
	public String getLotteryName() {
		return AppLotteryInfos.getLotteryName(LotteryIDUtils.FC3D_LOTTERY_ID_INT);
	}

	@Override
	public int getLogoResID() {
		return R.drawable.main_3d;
	}

	@Override
	public void initNumView(View view) {
		LinearLayout layout = (LinearLayout) view;
		layout.removeAllViews();
		String prizeNum = this.getPrizeNum();
		String[] nums = prizeNum.split(",");
		int arr_length = nums.length;
		int width = AppUtil.dip2px(App.getContext(), 30);
		for (int i = 0; i < arr_length; i++) {
			String num = nums[i];
			TextView mTxt_ball = new TextView(App.getContext());
			LayoutParams layoutParams = new LayoutParams(width, width);

			mTxt_ball.setLayoutParams(layoutParams);
			mTxt_ball.setGravity(Gravity.CENTER);
			mTxt_ball.setTextColor(Color.WHITE);
			mTxt_ball.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
			mTxt_ball.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));//加粗
			mTxt_ball.setText(num);
			if (i != 0) {
				layoutParams.setMargins(ballLeftMargin, 0, 0, 0);
			}
			mTxt_ball.setBackgroundResource(R.drawable.dot_ball_red);

			layout.addView(mTxt_ball);
		}
	}

}
